﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Spring.Objects.Factory.Config;

namespace Strongshell.Recoil.Tests.Utility
{
    public static class ObjectDefinitionExtensions
    {
        public static TType GetConstructorArgByIndex<TType>(this IObjectDefinition definition, int index)
        {
            return (TType)((ConstructorArgumentValues.ValueHolder)definition.ConstructorArgumentValues.IndexedArgumentValues[index]).Value;
        }

        public static TType GetPropertyByName<TType>(this IObjectDefinition definition, string name)
        {
            return (TType) definition.PropertyValues.GetPropertyValue(name).Value;
        }
    }
}
